package com.yongbao.controller.wechat;

import com.yongbao.common.WebResponse;
import com.yongbao.common.annotation.WebAccess;
import com.yongbao.common.PageInfo;
import com.yongbao.model.request.DishOrderSubRequest;
import com.yongbao.model.request.DishOrderSubStatisticsRequest;
import com.yongbao.model.vo.manual.DishOrderSubAddressStatisticsVO;
import com.yongbao.model.vo.manual.DishOrderSubAreaStatisticsVO;
import com.yongbao.model.vo.manual.DishOrderSubStreetStatisticsVO;
import com.yongbao.service.DishOrderSubService;
import com.yongbao.model.vo.DishOrderSubVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author zhanghong
 */
@RestController
@RequestMapping("/wechat/dishOrderSub")
@Api(value = "【小程序端】订单从模块", tags = {"【小程序端】订单从模块"})
public class WechatDishOrderSubController {

    @Autowired
    private DishOrderSubService dishOrderSubService;

    @WebAccess(login = true)
    @ApiOperation("分页查询")
    @PostMapping("/pageQuery")
    public WebResponse<PageInfo<DishOrderSubVO>> pageQuery(@RequestBody DishOrderSubRequest request) {
        return WebResponse.build(dishOrderSubService.pageQuery(request));
    }

    @WebAccess(login = true)
    @ApiOperation("查询区域统计")
    @PostMapping("/areaStatistics")
    public WebResponse<DishOrderSubAreaStatisticsVO> areaStatistics(@RequestBody DishOrderSubStatisticsRequest request) {
        return WebResponse.build(dishOrderSubService.areaStatistics(request));
    }

    @WebAccess(login = true)
    @ApiOperation("查询街道统计")
    @PostMapping("/streetStatistics")
    public WebResponse<List<DishOrderSubStreetStatisticsVO>> streetStatistics(@RequestBody DishOrderSubStatisticsRequest request) {
        return WebResponse.build(dishOrderSubService.streetStatistics(request));
    }

    @WebAccess(login = true)
    @ApiOperation("查询地址统计")
    @PostMapping("/addressStatistics")
    public WebResponse<List<DishOrderSubAddressStatisticsVO>> addressStatistics(@RequestBody DishOrderSubStatisticsRequest request) {
        return WebResponse.build(dishOrderSubService.addressStatistics(request));
    }

}
